/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"C101CD63-2F63-4CCC-A705-025E5E484049"}
 * @AllowToRunInFind
 */
function onShow(firstShow, event) {
	databaseManager.revertEditedRecords()
	databaseManager.setAutoSave(true)
	var query = 'SELECT cc.cliente_id as "cliente", SUM(importe_signo) as "sum_importe", SUM(saldo_signo) as "sum_saldo", SUM(importe_signo) - SUM(saldo_signo) as "diferencia" '+ 
				'FROM ctacte_cl as "cc" group by cc.cliente_id'
	var args = []
	var max = -1
	var $ds = databaseManager.getDataSetByQuery('infocom',query,args,max)

	var $nombre = 'compara_saldos_tab'
	var $frm = solutionModel.getForm($nombre)
	var $tipos = [JSColumn.INTEGER, JSColumn.NUMBER , JSColumn.NUMBER, JSColumn.NUMBER]
	$frm.dataSource = $ds.createDataSource('COMP_SALDOS',$tipos)
	forms[$frm.name].controller.recreateUI()
	
	forms[$frm.name].controller.find()
	forms[$frm.name].diferencia = '!=0'//'> 0.009' || '< -0.009'
	forms[$frm.name].controller.search()
	
	elements.tabs_140.removeAllTabs()
	elements.tabs_140.addTab(forms[$frm.name])
}
